
# glob 使用通配符 CONFIGURE_DEPENDS build时检查是否添加新文件，是则刷新
file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS *.cpp *.h *.ui)

if (${QT_VERSION_MAJOR} GREATER_EQUAL 6)
    qt_add_executable(LeChart
            MANUAL_FINALIZATION
            ${PROJECT_SOURCES}
            )
    # Define target properties for Android with Qt 6 as:
    #    set_property(TARGET LeChart APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
    #                 ${CMAKE_CURRENT_SOURCE_DIR}/android)
    # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else ()
    if (ANDROID)
        add_library(LeChart OBJECT
                ${PROJECT_SOURCES}
                )
        # Define properties for Android with Qt 5 after find_package() calls as:
        #    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
    else ()
        add_executable(LeChart
                ${PROJECT_SOURCES}
                )
    endif ()
endif ()

if (QT_VERSION_MAJOR EQUAL 6)
    qt_finalize_executable(LeChart)
endif ()

# 添加.h路径避免ui内提升类生成.h文件include路径出错
target_include_directories(LeChart PRIVATE view model)

# 动态库
target_link_libraries(LeChart PRIVATE
        Qt${QT_VERSION_MAJOR}::Widgets
        Qt${QT_VERSION_MAJOR}::Charts
        )

#message(STATUS $ENV{QT_ASSUME_STDERR_HAS_CONSOLE})
